const express = require("express");
const formatResponse = require("../utils/responseFormat");
const setting = require("../service/settingService");
const settingRouter = express.Router();

//修改全局配置
settingRouter.put("/", async (req, res, next) => {
  const info = req.body;
  const data = await setting.setSetting(info);
  res.send(formatResponse(0, "", data));
});

//获取全局配置
settingRouter.get("/", async (req, res, next) => {
  const data = await setting.getSetting();
  res.send(formatResponse(0, "", data));
});

module.exports = settingRouter;
